<?php
	$mode=$_GET['mode'];
	$obj=new Menu();
	$obj->MenuID=mysql_real_escape_string($_POST['MenuID']);
	$obj->ModuleID=mysql_real_escape_string($_POST['ModuleID']);
	$obj->Param=mysql_real_escape_string($_POST['Param']);
	$obj->MenuUrl=mysql_real_escape_string($_POST['MenuUrl']);
	$obj->MenuName=mysql_real_escape_string($_POST['MenuName']);
	$obj->MenuNameEng=mysql_real_escape_string($_POST['MenuNameEng']);
	$obj->Summary=mysql_real_escape_string($_POST['Summary']);
	$obj->SummaryEng=mysql_real_escape_string($_POST['SummaryEng']);
	$obj->MenuDetail= mysql_real_escape_string( $_POST['MenuDetail']);
	$obj->MenuDetailEng=mysql_real_escape_string($_POST['MenuDetailEng']);
	$obj->MenuParent=mysql_real_escape_string($_POST['MenuParent']);
	$obj->Pos=mysql_real_escape_string($_POST['Pos']);
	
	if($mode=="add" && $_POST['MenuName']!="")
	{
		$obj->insert($conn);
		
		
		

		
	}
	
	if($mode=="edit")
	{
		
		$obj->updateContent($conn);
	}
	if($mode=="editcontact")
	{
		$obj->updateContent($conn);
		$obj->ListEmail = arrToList($_POST['email'],",");
		$obj->updateListEmail($conn);
	}
	if($mode=="editparam")
	{
		$obj->updateParam($conn);
	}
	if($mode=="update")
	{
		$obj->update($conn);
		
		
		
		
	}
	if($mode=="del")
	{
		$obj->MenuID=$id;
		$obj->delete($conn);
	}
	$url="?module=$module";
	echo "<script language='JavaScript'> window.location = '".$url."'</script>";
	
?>